﻿function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
